
- name: setup the PDC copr repo
  copy: >
    src="xchu-pdc-epel-7.repo"
    dest="/etc/yum.repos.d/xchu-pdc-epel-7.repo"
    owner=root
    group=root
    mode=0644
  tags:
  - pdc

- name: setup the patternfly copr repo
  copy: >
    src="patternfly-patternfly1-epel-7.repo"
    dest="/etc/yum.repos.d/patternfly-patternfly1-epel-7.repo"
    owner=root
    group=root
    mode=0644
  tags:
  - pdc

- name: install needed packages
  yum: pkg={{ item }} state=present
  with_items:
  - patternfly1
  - pdc-server
  - xmlsec1
  tags:
  - pdc

- name: Copy over settings_local.py
  template: src=settings_local.py dest=/usr/lib/python2.7/site-packages/pdc/settings_local.py
  notify: reload httpd
  tags:
  - pdc

- name: Copy over httpd config
  template: src=pdc.conf dest=/etc/httpd/conf.d/pdc.conf
  notify: reload httpd
  tags:
  - pdc

- name: create /etc/httpd/saml2
  action: file state=directory
               path=/etc/httpd/saml2
               owner=apache group=apache mode=0775
  tags:
  - pdc

- name: Install saml2 xml files
  copy: >
    src="{{ item }}" dest="/etc/httpd/saml2/{{ item }}"
    owner="apache" group="apache" mode=0600
  with_items:
    - metadata.xml
    - idp-metadata.xml
  tags:
  - pdc

- name: Install saml2 certs
  copy: >
    src="{{ private}}/files/httpd/{{ item }}" dest="/etc/httpd/saml2/{{ item }}"
    owner="apache" group="apache" mode=0600
  with_items:
    - pdc.fedorainfracloud.org.pem
    - pdc.fedorainfracloud.org.key
  tags:
  - pdc

- name: ensure selinux lets httpd talk to postgres
  seboolean: name=httpd_can_network_connect_db persistent=yes state=yes
  tags:
  - pdc
  - selinux
